﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using QConnectSDK;
using QConnectSDK.Models;
using System.Web.Security;

namespace PlugNT.Cms.Web
{
    public partial class QQCallback : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Params["code"] != null)
            {
                if (Session["requeststate"] != null)
                {

                    QOpenClient qzone = null;
                    User currentUser = null;
                    var verifier = Request.Params["code"];
                    string state = Session["requeststate"].ToString();
                    qzone = new QOpenClient(verifier, state);
                    currentUser = qzone.GetCurrentUser();
                    Session["QzoneOauth"] = qzone;
                    if (null != currentUser)
                    {
                        Response.Redirect("QQRegister.aspx");
                        //this.result.Text = "成功登陆";
                        //this.Nickname.Text = currentUser.Nickname;
                        //this.Figureurl.ImageUrl = currentUser.Figureurl;
                    }
                }
            }
        }
    }
}